#include<stdio.h>
#include<unistd.h>
#include<string.h>
double bandwidth=1024*100*1.0; 
void ProcessBar(double filesize,double temsize)
{
	char round[]="-\\|/";
	char style ='-';
	char bar[101];
	int length = sizeof(bar);
	memset(bar,'\0',length);
	double rate =temsize*100/filesize;
	int pace =(int)rate;
	int i= 0;
	for(i=0;i<pace-1;i++)
		bar[i]=style;
	bar[i]='|';
	printf("[%-100s][%5.1lf%%][%c]\r",bar,rate,round[pace%4]);
}
void DownLoad(double filesize)
{
	printf("DownLoad:file %.0lfbite begin!\n",filesize);
	double temsize =0.0;
	while(temsize<=filesize)
	{
		ProcessBar(filesize,temsize);
		temsize+=bandwidth/100;
		usleep(10000);
	}
	printf("\n");
	printf("Complate!\n");
}
